import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '../views/Home.vue';

Vue.use(VueRouter);

const routes = [
	{
		path: '/',
		redirect: '/home',
	},
	{
		path: '/home',
		component: Home,
		redirect: '/home/movies',
		children: [
			{
				path: 'movies',
				name: 'movies',
				meta: {
					info: 1,
				},
				component: () => import('@/views/home/movies/Movies.vue'),
			},
			{
				path: 'theaters',
				name: 'theaters',
				meta: {
					isLogin: true
				},
				component: () => import('@/views/home/theaters/Theaters.vue'),
			},
			{
				path: 'videos',
				name: 'videos',
				meta: {
					isLogin: false
				},
				component: () => import('@/views/home/videos/ShortVideo.vue'),
			},
			{
				path: 'profile',
				name: 'profile',
				meta: {
					isLogin: false
				},
				component: () => import('@/views/home/profile/Profile.vue'),
			},
			{
				path: '/personal',
				name: 'personal',
				meta: {
					isLogin: true
				},
				component: () => import('@/views/home/profile/Personal.vue'),
			},
		],
	},
	{
		path: '/search1',
		name: 'search1',
		meta: {
			isLogin: false
		},
		component: () => import('@/views/search/Search1.vue'),
	},
	{
		path: '/search2',
		name: 'search2',
		meta: {
			isLogin: false
		},
		component: () => import('@/views/search/Search2.vue'),
	},
	{
		path: '/details',
		name: 'details',
		meta: {
			isLogin: true
		},
		component: () => import('@/views/details/MovieDetails.vue'),
	},
	{
		path: '/details2',
		name: 'details2',
		meta: {
			isLogin: true
		},
		component: () => import('@/views/details/TheaterDetails.vue'),
	},
	{
		path: '/citypicker',
		name: 'citypicker',
		component: () => import('@/views/citypicker/CityPicker.vue'),
	},
	{
		path: '/citypicker2',
		name: 'citypicker2',
		component: () => import('@/views/citypicker/CityPicker2.vue'),
	},

	{
		path: '/about',
		name: 'about',
		// route level code-splitting
		// this generates a separate chunk (about.[hash].js) for this route
		// which is lazy-loaded when the route is visited.
		component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue'),
	},
];

const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes,
});

export default router;
